package org.jsola.hr.web;

import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.constant.HrConstants;
import org.jsola.hr.query.AttendPunchTimeQuery;
import org.jsola.hr.query.AttendRecordStatQuery;
import org.jsola.hr.service.IAttendRecordStatService;
import org.jsola.hr.vo.AttendPunchTimeListVO;
import org.jsola.hr.vo.AttendRecordStatVO;
import org.jsola.user.core.TokenUser;
import org.jsola.user.core.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 *
 *
 * @author wxz
 */
@RestController("hrAttendRecordStatController")
@RequestMapping(HrConstants.API_PATH + "/v1/attendRecordStat")
public class AttendRecordStatController implements IAttendRecordStatControllerAPI {

    @Autowired
    private IAttendRecordStatService attendRecordStatService;

    @Override
    @GetMapping
    public Result<Page<AttendRecordStatVO>> page(@Valid AttendRecordStatQuery attendRecordStatQuery) {
        TokenUser tokenUser = UserContext.getUser();
        // todo 查看项目权限校验

        return Result.success(
                attendRecordStatService.selectPage(attendRecordStatQuery, tokenUser.getSiteId())
        );
    }


}
